package d0324;

import com.text0309.Person;

public class Sheep2 implements Cloneable {
    private String name;
    private int age;
    private Person owner;

    public Sheep2(String name, int age, Person owner) {
        this.name = name;
        this.age = age;
        this.owner = owner;
    }

    public Sheep2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person getOwner() {
        return owner;
    }

    public void setOwner(Person owner) {
        this.owner = owner;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        Person person1=new Person("Own1",22,"Dalian");
        Person person2=new Person("Ow2",23,"Tianjing");
        Sheep2 s1=new Sheep2("Alice",3,person1);
        try {
            Sheep2 duoli=(Sheep2)s1.clone();
            //s1.setName("Jone");
            s1.setOwner(person1);
            // System.out.println("s1==duoli:"+(s1==duoli));
            //System.out.println(duoli.name+"\t"+duoli.age);

        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}